package com.pond.pond.controller;

import java.util.List;
import javax.servlet.http.HttpServletResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.PutMapping;
import org.springframework.web.bind.annotation.DeleteMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import com.pond.common.log.annotation.Log;
import com.pond.common.log.enums.BusinessType;
import com.pond.common.security.annotation.RequiresPermissions;
import com.pond.pond.domain.PondReview;
import com.pond.pond.service.IPondReviewService;
import com.pond.common.core.web.controller.BaseController;
import com.pond.common.core.web.domain.AjaxResult;
import com.pond.common.core.utils.poi.ExcelUtil;
import com.pond.common.core.web.page.TableDataInfo;

/**
 * 鱼塘评价Controller
 * 
 * @author ruoyi
 * @date 2025-07-15
 */
@RestController
@RequestMapping("/pondReview")
public class PondReviewController extends BaseController
{
    @Autowired
    private IPondReviewService pondReviewService;

    /**
     * 查询鱼塘评价列表
     */
    @RequiresPermissions("pond:pondReview:list")
    @GetMapping("/list")
    public TableDataInfo list(PondReview pondReview)
    {
        startPage();
        List<PondReview> list = pondReviewService.selectPondReviewList(pondReview);
        return getDataTable(list);
    }

    /**
     * 导出鱼塘评价列表
     */
    @RequiresPermissions("pond:pondReview:export")
    @Log(title = "鱼塘评价", businessType = BusinessType.EXPORT)
    @PostMapping("/export")
    public void export(HttpServletResponse response, PondReview pondReview)
    {
        List<PondReview> list = pondReviewService.selectPondReviewList(pondReview);
        ExcelUtil<PondReview> util = new ExcelUtil<PondReview>(PondReview.class);
        util.exportExcel(response, list, "鱼塘评价数据");
    }

    /**
     * 获取鱼塘评价详细信息
     */
    @RequiresPermissions("pond:pondReview:query")
    @GetMapping(value = "/{id}")
    public AjaxResult getInfo(@PathVariable("id") Long id)
    {
        return success(pondReviewService.selectPondReviewById(id));
    }

    /**
     * 新增鱼塘评价
     */
    @RequiresPermissions("pond:pondReview:add")
    @Log(title = "鱼塘评价", businessType = BusinessType.INSERT)
    @PostMapping
    public AjaxResult add(@RequestBody PondReview pondReview)
    {
        return toAjax(pondReviewService.insertPondReview(pondReview));
    }

    /**
     * 修改鱼塘评价
     */
    @RequiresPermissions("pond:pondReview:edit")
    @Log(title = "鱼塘评价", businessType = BusinessType.UPDATE)
    @PutMapping
    public AjaxResult edit(@RequestBody PondReview pondReview)
    {
        return toAjax(pondReviewService.updatePondReview(pondReview));
    }

    /**
     * 删除鱼塘评价
     */
    @RequiresPermissions("pond:pondReview:remove")
    @Log(title = "鱼塘评价", businessType = BusinessType.DELETE)
	@DeleteMapping("/{ids}")
    public AjaxResult remove(@PathVariable Long[] ids)
    {
        return toAjax(pondReviewService.deletePondReviewByIds(ids));
    }
}
